/**************************************************************************/
-static void str2lab(char* dest, char* src, int len, char* fmt, int n)
+static void str2lab(char* dest, const char* src, int len, const char* fmt,
+ int n)
{
int i,j;
#ifndef GARMIN_GPI_H
#define GARMIN_GPI_H
-static char gpi_bitmap[] = {
+static unsigned char gpi_bitmap[] = {
0x00,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x08,0x00,0x00,0x00,0x40,0x02,0x00,0x00,
0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0xff,0x00,0xff,0x00,0x01,0x00,0x00,0x00,
0x6c,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
}
}
-char*
+const char*
gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic)
{
icon_mapping_t* i;
const char*
gt_get_mps_datum_name(const int datum_index)
{
- char* result;
+ const char* result;
datum_mapping_t* d;
result = GPS_Math_Get_Datum_Name(datum_index);
typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e;
-char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic);
+const char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic);
int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin_format);
extern icon_mapping_t garmin_icon_table[];
static int route_idx;
static info_t* cur_info;
-static char* headers[] = {
+static const char* headers[] = {
"Name\tDescription\tType\tPosition\tAltitude\tDepth\tProximity\tTemperature\t"
"Display Mode\tColor\tSymbol\tFacility\tCity\tState\tCountry\t"
"Date Modified\tLink\tCategories",
unsigned char wpt_class;
garmin_fs_p gmsd;
char* wpt_type;
- char* dspl_mode;
+ const char* dspl_mode;
const char* country;
double x;
int i, icon, dynamic;
- char* icon_descr;
+ const char* icon_descr;
gmsd = GMSD_FIND(wpt);
icon_descr = gt_find_desc_from_icon_number(icon, GDB, &dynamic);
print_string("%s\t", icon_descr);
if (dynamic) {
- xfree(icon_descr);
+ // sleaze alert: cast away constness.
+ xfree((char *) icon_descr);
}
print_string("%s\t", GMSD_GET(facility, ""));
static void itracku_file_write_waypt(gbfile* fout, const waypoint* wpt);
/* itracku device access */
-static const char read_update_data_command[] = { 0x60, 0xb5, 0, 0, 0, 0, 0 }; /* command string to start memory dump */
+static const unsigned char read_update_data_command[] = { 0x60, 0xb5, 0, 0, 0, 0, 0 }; /* command string to start memory dump */
static const int timeout = 1000; /* timeout for all read operations */
static const char update_end_marker[] = "WP Update Over"; /* end marker for the memory dump */
static const int update_end_marker_size = sizeof(update_end_marker);
typedef struct GPS_SEllipse {
- char* name;
+ const char* name;
double a;
double invf;
} GPS_OEllipse, *GPS_PEllipse;
typedef struct GPS_SDatum {
- char* name;
+ const char* name;
int ellipse;
double dx;
double dy;
typedef struct GPS_SDatum_Alias {
- char* alias;
+ const char* alias;
const int datum;
} GPS_ODatum_Alias, *GPS_PDatum_Alias;
/* UK Ordnance Survey Nation Grid Map Codes */
- static char* UKNG[]= {
+ static const char* UKNG[]= {
"SV","SW","SX","SY","SZ","TV","TW","SQ","SR","SS","ST","SU","TQ","TR",
"SL","SM","SN","SO","SP","TL","TM","SF","SG","SH","SJ","SK","TF","TG",
"SA","SB","SC","SD","SE","TA","TB","NV","NW","NX","NY","NZ","OV","OW",
#include "config.h"
#endif
#if HAVE_LIBUSB
-#include <usb.h>
+#include "usb.h"
#include "gps.h"
#include "garminusb.h"
#include "gpsusbcommon.h"
unsigned
gusb_reset_toggles(void)
{
- static const char oinit[12] =
+ static const unsigned char oinit[12] =
{0, 0, 0, 0, GUSB_SESSION_START, 0, 0, 0, 0, 0, 0, 0};
- static const char oid[12] =
+ static const unsigned char oid[12] =
{20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0};
garmin_usb_packet iresp;
int t;
return -1;
}
-char*
+const char*
GPS_Math_Get_Datum_Name(const int datum_index)
{
return GPS_Datum[datum_index].name;
const double lambda0, const double E0, const double N0);
int32 GPS_Lookup_Datum_Index(const char* n);
- char* GPS_Math_Get_Datum_Name(const int datum_index);
+ const char* GPS_Math_Get_Datum_Name(const int datum_index);
#endif
void
gusb_id_unit(garmin_unit_info_t* gu)
{
- static const char oid[12] =
+ static const unsigned char oid[12] =
{20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0};
garmin_usb_packet iresp;
int i;
** @@
****************************************************************************/
-void GPS_Warning(char* s)
+void GPS_Warning(const char* s)
{
if (!gps_warning) {
return;
** @@
****************************************************************************/
-void GPS_Fatal(char* s)
+void GPS_Fatal(const char* s)
{
fprintf(stderr,"[FATAL] %s\n",s);
** @@
****************************************************************************/
-void GPS_Error(char* fmt, ...)
+void GPS_Error(const char* fmt, ...)
{
va_list argp;
va_start(argp, fmt);
void GPS_Util_Put_Uint(UC* s, const uint32 v);
uint32 GPS_Util_Get_Uint(const UC* s);
- void GPS_Warning(char* s);
- void GPS_Error(char* fmt, ...);
+ void GPS_Warning(const char* s);
+ void GPS_Error(const char* fmt, ...);
void GPS_Serial_Error(const char* hdr, ...);
- void GPS_Fatal(char* s);
+ void GPS_Fatal(const char* s);
void GPS_Enable_Error(void);
void GPS_Enable_Warning(void);
void GPS_Disable_Error(void);
gbfclose(ofd);
}
-static char*
+static const char*
lmx_stag(int tag)
{
switch (tag) {
mkshort_del_handle(&mkshort_handle);
}
-convert_rec0(struct record0* rec0)
+void convert_rec0(struct record0* rec0)
{
Lon1 = be_read32(&rec0->lon1) / LONDIV;
Lat1 = be_read32(&rec0->lat1) / LATDIV;
len = (unsigned)gbfgetc(fin);
if (len > 0) {
int ii, jj, ch, resbytes=0;
- res = xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion
+ res = (char *) xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion
for (ii=0; ii<len; ii++) {
char utf8buf[8];
int utf8len;
// positive values of len are for strings longer than 254, handled below:
}
// length zero returns an empty string
- res = xmalloc(len + 1);
+ res = (char *) xmalloc(len + 1);
res[len] = '\0';
if (len) {
gbfread(res, len, 1, fin);
/* Naviguide file header */
typedef struct {
gbuint16 nof_wp; /* Little endean format */
- char pad1[6]; /* 0xff, 0xff, 0x01, 0x00, 0x06, 0x00 */
+ unsigned char pad1[6]; /* 0xff, 0xff, 0x01, 0x00, 0x06, 0x00 */
char signature[9]; /* cWaypoint */
- char pad2[4]; /* 0x01, 0x00, 0x00, 0x00 */
+ unsigned char pad2[4]; /* 0x01, 0x00, 0x00, 0x00 */
} ng_file_header_t;
/* Naviguide waypoint/rout data */
typedef struct {
- char pad1[8]; /* 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 */
+ unsigned char pad1[8]; /* 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 */
/* coordination are in old israeli grid */
gbuint32 East;
gbuint32 North;
- char pad2[2]; /* 0x01, 0x01 */
+ unsigned char pad2[2]; /* 0x01, 0x01 */
gbuint32 Alt;
char CommentLength;
} ng_wp_data_t;
typedef struct {
- char pad1[2]; /* 0x01, 0x80 */
+ unsigned char pad1[2]; /* 0x01, 0x80 */
gbuint16 next_wp;
- char pad2[2]; /* 0x00, 0x00 */
+ unsigned char pad2[2]; /* 0x00, 0x00 */
} ng_next_wp_t;
typedef struct {
/* Note: the buffer is being padded with 0xFFs if necessary so there are always SECTOR_SIZE valid bytes */
static int
-skytraq_read_single_sector(int sector, gbuint8 *buf)
+skytraq_read_single_sector(unsigned int sector, gbuint8 *buf)
{
- gbuint8 MSG_LOG_SECTOR_READ_CONTROL[2] = { 0x1B, sector };
+ gbuint8 MSG_LOG_SECTOR_READ_CONTROL[2] = { 0x1B, (gbuint8)(sector) };
int errors = 5; /* allow this many errors */
int c, i, j, cs;
gbuint8 buffer[16];
-struct xt_mapping {char *name; int xt_token; };
+struct xt_mapping {const char *name; int xt_token; };
%%
ALT_FEET, XT_ALT_FEET
ALT_METERS, XT_ALT_METERS